/*
 * @Author: zxc
 * @Date: 2020-11-25 10:18:13
 * @LastEditTime: 2020-11-25 10:23:54
 * @LastEditors: zxc
 * @Description:状态模式
 */
/**
 * @Author: zxc
 * @Date: 2020-11-25 10:18:24
 * @func 抽象类的变通方式
 */
abstract class State {
  abstract buttonWasPressed(): void
}

class SuperStrongLightState extends State {
  light: any
  constructor(light: any) {
    super()
    this.light = light
  }
  buttonWasPressed(): void {
    console.log("关灯")
    this.light.setState(this.light.offLightState)
  }
}
